home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / gamesmaster / source / asm / screendemos / hiresscreen.s < prev    next >
Encoding:
Text File  |  1996-09-11  |  3.1 KB  |  114 lines

  1. ;HiRes Picture Display
  2. ;---------------------
  3. ;Opens a screen of 640 pixels width in HIRES mode.  You can even try
  4. ;SuperHiRes (SHIRES) if you change the appropriate flag in the GameScreen
  5. ;structure.
  6.  
  7.     opt    o+
  8.  
  9.     INCLUDE    "exec/exec_lib.i"
  10.     INCLUDE    "games/games_lib.i"
  11.     INCLUDE    "games/games.i"
  12.  
  13. CALL    MACRO
  14.     jsr    _LVO\1(a6)
  15.     ENDM
  16.  
  17.     SECTION    "HiResScreen",CODE
  18.  
  19. ;===========================================================================;
  20. ;                             INITIALISE DEMO
  21. ;===========================================================================;
  22.  
  23. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  24.     move.l    ($4).w,a6
  25.     lea    GMS_Name(pc),a1
  26.     moveq    #$00,d0
  27.     CALL    OpenLibrary
  28.     move.l    d0,GMS_Base
  29.     beq.s    Quit
  30.  
  31.     move.l    GMS_Base(pc),a6          ;Tell GMS that we want to add a
  32.     CALL    SetUserPri
  33.  
  34.     lea    ScreenStruct(pc),a0      ;screen for use.
  35.     CALL    Add_Screen
  36.     tst.l    d0
  37.     bne.s    Error
  38.  
  39.     lea    Picture(pc),a1           ;a1 = Picture struct.
  40.     move.l    SS_MemPtr1(a0),PIC_Data(a1)
  41.     lea    PicFile(pc),a0           ;a0 = Picture file.
  42.     CALL    LoadPic
  43.     tst.w    d0
  44.     bne.s    ReturnToDOS
  45.  
  46.     lea    ScreenStruct(pc),a0      ;Now show the screen/pic.
  47.     CALL    Show_Screen
  48.  
  49. ;===========================================================================;
  50. ;                                MAIN LOOP
  51. ;===========================================================================;
  52.  
  53.     CALL    Wait_LMB
  54.  
  55. ;===========================================================================;
  56. ;                              RETURN TO DOS
  57. ;===========================================================================;
  58.  
  59. ReturnToDOS:
  60.     move.l    GMS_Base(pc),a6
  61.     lea    ScreenStruct(pc),a0
  62.     CALL    Delete_Screen            ;Give back screen memory etc.
  63. Error:    move.l    GMS_Base(pc),a1
  64.     move.l    ($4).w,a6
  65.     CALL    CloseLibrary
  66. Quit:    MOVEM.L    (SP)+,A0-A6/D1-D7
  67.     moveq    #$00,d0
  68.     rts
  69.  
  70. ;===========================================================================;
  71. ;                                  DATA
  72. ;===========================================================================;
  73.  
  74. GMS_Name:
  75.     dc.b    "games.library",0
  76.     even
  77. GMS_Base:
  78.     dc.l    0
  79.  
  80. AMT_PLANES =    4
  81.  
  82. ScreenStruct:
  83.     dc.l    "GSV1",0
  84.     dc.l    0,0,0             ;Screen_Mem1/2/3
  85.     dc.l    0                 ;Screen link.
  86.     dc.l    Palette           ;Address of palette
  87.     dc.l    0                 ;Address of rasterlist
  88.     dc.l    16                ;Amt of colours in palette.
  89.     dc.w    640,256,640,256   ;Screen & Pic Height/Width. 
  90.     dc.w    AMT_PLANES        ;Amt of planes
  91.     dc.w    0,0               ;X/Y screen offset.
  92.     dc.w    0,0               ;X/Y picture offset.
  93.     dc.l    0                 ;Special attributes.
  94.     dc.w    HIRES             ;Screen mode.
  95.     dc.b    INTERLEAVED       ;Screen type
  96.     dc.b    0                 ;Reserved.
  97.     even
  98.  
  99. Palette    dc.w    $0000,$0400,$0501,$0501,$0601,$0701,$0701,$0801
  100.     dc.w    $0901,$0A01,$0B02,$0432,$0CC0,$0F00,$0211,$0880
  101.  
  102. Picture    dc.l    "PCV1",0           ;Version header.
  103.     dc.l    0                  ;Source data.
  104.     dc.w    320,256            ;Width, Height.
  105.     dc.w    AMT_PLANES         ;Amount of Planes.
  106.     dc.l    16                 ;Amount of colours.
  107.     dc.l    Palette            ;Source palette (remap).
  108.     dc.w    HIRES              ;Screen mode.
  109.     dc.w    INTERLEAVED        ;Destination
  110.     dc.l    0                  ;Parameters.
  111.  
  112. PicFile    dc.b    "GAMESLIB:data/IFF.Pic640x256",0
  113.     even
  114.